### we prepend t_ to tablenames and f_ to fieldnames for disambiguity


########################################
db.define_table('t_moment',
    Field('id','id',
          represent=lambda id:SPAN(id,' ',A('view',_href=URL('moment_read',args=id)))),
    Field('f_title_string', type='string',
          label=T('Title String')),
    Field('f_description', type='text',
          label=T('Description')),
    Field('f_datetaken', type='date',
          label=T('Datetaken')),
    Field('f_photo', type='upload',
          represent=lambda x: x and A('download',_href=URL('download',args=x)) or '',
          label=T('Photo')),
    Field('f_lat', type='double',
          label=T('Lat')),
    Field('f_long', type='double',
          label=T('Long')),
    Field('f_icon_string', type='string',
          label=T('Icon String')),
    Field('active','boolean',default=True,
          label=T('Active'),writable=False,readable=False),
    Field('created_on','datetime',default=request.now,
          label=T('Created On'),writable=False,readable=False),
    Field('modified_on','datetime',default=request.now,
          label=T('Modified On'),writable=False,readable=False,
          update=request.now),
    Field('created_by',db.auth_user,default=auth.user_id,
          label=T('Created By'),writable=False,readable=False),
    Field('modified_by',db.auth_user,default=auth.user_id,
          label=T('Modified By'),writable=False,readable=False,
          update=auth.user_id),
    format='%(f_title_string)s',
    migrate=settings.migrate)

db.define_table('t_moment_archive',db.t_moment,Field('current_record','reference t_moment'))
